﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Icoders.MarketTracker.Web.Lib.Response.Containers;
using Icoders.MarketTracker.Web.Lib.Response.Services;

namespace Icoders.MarketTracker.Web.Controllers
{
    public class ApplicationController : Controller
    {
        //
        // GET: /Application/
        private ICreateApplicationService _createApplicationService;

        public ApplicationController(ICreateApplicationService createApplicationService)
        {
            _createApplicationService = createApplicationService;
        }

        public JsonResult CreateApplication(string username, string password)
        {
            CreateApplicationResponse result = null;
            try
            {
                result = _createApplicationService.CreateApplication(username, password);
            }
            catch (Exception ex)
            {
                result = new CreateApplicationResponse { ErrorInfo = "Failed to CreateApplication" };
               
            }
            return Json(result, JsonRequestBehavior.AllowGet);
        }

    }
}
